package com.whw.fy.controller;

import com.whw.fy.entity.Message;
import com.whw.fy.entity.Pay;
import com.whw.fy.entity.Room;
import com.whw.fy.service.RoomService;
import com.whw.fy.utils.GenIdUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;

@Api(tags = "教室模块")
@RestController
@RequestMapping("/api/room")
public class RoomController {
    @Resource
    private RoomService roomService;

    @ApiOperation(value = "新增房间")
    @PostMapping("/")
    public Message insert(Room room){

        return roomService.insertSelective(room);
    }

    @ApiOperation(value = "根据id删除房间")
    @DeleteMapping("/")
    public Message delete(int id){
        return roomService.deleteByPrimaryKey(id);
    }

    @ApiOperation(value = "修改房间")
    @PutMapping("/")
    public Message update(Room room){
        return roomService.updateByPrimaryKeySelective(room);
    }

    @ApiOperation(value = "根据id查看房间")
    @GetMapping("/")
    public Message selectById(int id){
        return roomService.selectByPrimaryKey(id);
    }

    @ApiOperation(value = "查询所有房间")
    @GetMapping("/all")
    public Message selectAll(){
        return roomService.selectAll();
    }
}
